﻿using System.Configuration;

namespace Mp3Observer.Common.IoC
{
    /// <summary>
    /// inversion of control App.Config Configuration 
    /// </summary>
    /// <example>
    /// Example of an app.config:
    /// <code>
    /// <![CDATA[ 
    /// <configSections>
    ///     <section name="IoCSettings" type="Mp3Observer.Common.IoC.IoCSettingsConfigSection, Mp3Observer.Common" />
    /// </configSections>
    /// <IoCSettings>
    ///     <Components resolver="Mp3Observer.Common.IoC.DependencyResolver, Mp3Observer.Common">
    ///          <add contract="Mp3Observer.Interfaces.IFileSearch,  Mp3Observer.Interfaces" implementation="Mp3Observer.Services.FileSearch,  Mp3Observer.Services" />
    ///         <add contract="Mp3Observer.Interfaces.IMessageBox,  Mp3Observer.Interfaces" implementation="Mp3Observer.Services.MessageBox,  Mp3Observer.Services" />
    ///     </Components>
    /// </IoCSettings>
    /// ]]>
    /// </code>
    /// </example>
    public class IoCSettingsConfigSection : ConfigurationSection
    {
        /// <summary>
        /// the IoCSettings section.
        /// </summary>
        private static IoCSettingsConfigSection section = (IoCSettingsConfigSection)ConfigurationManager.GetSection("IoCSettings");

        /// <summary>
        /// Gets the settings section.
        /// </summary>
        /// <value>The settings.</value>
        public static IoCSettingsConfigSection Settings
        {
            get { return section; }
        }

        /// <summary>
        /// Gets the components.
        /// </summary>
        /// <value>The components.</value>
        [ConfigurationProperty("Components")]
        public ComponentsCollection Components
        {
            get { return (ComponentsCollection)base["Components"]; }
        }
    }
}
